package com.aloudmeta.grpc.support.interceptors;

import io.grpc.Context;
import org.apache.dubbo.rpc.protocol.grpc.interceptors.ServerInterceptor;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;

/**
 * huaixin 2022/1/23 3:30 PM
 */
public interface AuthenticatingServerInterceptor extends ServerInterceptor {

    /**
     * The context key that can be used to retrieve the associated {@link Authentication}.
     */
    Context.Key<SecurityContext> SECURITY_CONTEXT_KEY = Context.key("security-context");

    /**
     * The context key that can be used to retrieve the originally associated {@link Authentication}.
     *
     * @deprecated Use {@link #SECURITY_CONTEXT_KEY} instead.
     */
    @Deprecated
    Context.Key<Authentication> AUTHENTICATION_CONTEXT_KEY = Context.key("authentication");
}
